package club.emergency.wechat.authorization.operate;

import club.emergency.wechat.model.role.Role;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.authorization.operate
 * Date: 2019/3/19
 *
 * @author: 快乐的小菌菌
 * Description:
 */
public interface AuthorizationOperate {

    /**
     * 新增用户
     *
     * @param role             用户pojo
     * @param authorizationIds 多个权限id，逗号分隔
     * @return 以字符串形式返回
     */
    @PostMapping("/authorization-operate-provider/saveRole")
    String saveRole(@RequestBody Role role, @RequestParam(value = "authorizationIds", required = false) String authorizationIds);


    /**
     * 编辑角色
     *
     * @param role             用户pojo
     * @param authorizationIds 多个权限id，逗号分隔
     * @return 以字符串形式返回
     */
    @PostMapping("/authorization-operate-provider/editRole")
    String editRole(@RequestBody Role role, @RequestParam(value = "authorizationIds", required = false) String authorizationIds);

    /**
     * 删除角色
     *
     * @param id 角色id
     * @return 以字符串形式返回
     */
    @PostMapping("/authorization-operate-provider/removeRole")
    String removeRole(@RequestParam("id") Long id);

    /**
     * 用户绑定角色，编辑修改功能
     *
     * @param managerId 后台用户id
     * @param roleIds   角色ids，逗号分隔（可以是一个）
     * @return 以字符串形式返回
     */
    @PostMapping("/authorization-operate-provider/bindManager")
    String bindManager(@RequestParam("managerId") Long managerId, @RequestParam("roleIds") String roleIds);

}
